﻿using System;
using System.Data;
using System.Drawing;
using System.Web.UI.WebControls;
using HiauPdm.Bll;
using HiauPdm.Web;

namespace HiauPdm.Web
{
    public partial class FileImport : PageBase
    {
        protected override bool IsAccess()
        {
            return true;
        }

        /// <summary>
        /// 加载
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack) { return; }
            BtnImport.OnClientClick = "if(ImportCheck()){this.disabled=true;" + Page.ClientScript.GetPostBackEventReference(BtnImport, null) + ";}return false;";
        }

        /// <summary>
        /// 导入
        /// </summary>
        protected void BtnImport_Click(object sender, EventArgs e)
        {
            string sOutFileName = string.Empty;
            if (!ShowErr(BJcSj.ImportFile(FileUpload1, ref sOutFileName)))
            {
                Response.Write(string.Format("<script type='text/javascript'>top.returnValue=true;top.opener.returnFileName='{0}';top.close();</script>", sOutFileName));
            }
        }
    }
}